React Eval#21
Open
JoeCarnahan42 wants to merge 9 commits into
Open
Conversation
…O for individual contact view
| <form className="text-center p-3 mx-auto border rounded w-25 p-3"> | ||
| <label><u>Name</u></label> | ||
| <br /> | ||
| <input onChange={enableSubmit} required ref={nameInput} className="input-group-text m-auto" type="text" /> |
There was a problem hiding this comment.
DRY, you can use JS helper methods to make this efficient
| const [search, setSearch] = useState(Data.all()) | ||
| const searchCon = (e) => { | ||
| const normData = e.target.value.toLowerCase() | ||
| if (e.target.value === '') { |
| @@ -0,0 +1,52 @@ | |||
| const Data = { | |||
| contacts: [ | |||
There was a problem hiding this comment.
what is the difference between this and get all contacts?
| "phone_number": "+1-555-567-8901" | ||
| } | ||
| ], | ||
| all: function () { |
There was a problem hiding this comment.
you are already exposing all the contacts
| export default function Contact(prop) { | ||
| const id = JSON.parse(prop.searchParams.id) | ||
|
|
||
| const contact = Data.contacts.find((c) => { |
There was a problem hiding this comment.
why you are not using the GET you created?
| const id = JSON.parse(prop.searchParams.id) | ||
|
|
||
| const contact = Data.contacts.find((c) => { | ||
| return c.id === id |
There was a problem hiding this comment.
what happens when no contact is found? you will have errors
Comment on lines
+17
to
+19
|
|
||
|
|
||
|
|
|
|
||
| const addCon = (e) => { | ||
| e.preventDefault() | ||
| console.log('Adding...') |
There was a problem hiding this comment.
do not push console logs that have no purpose
|
|
||
| const enableSubmit = () => { | ||
|
|
||
| const isValidUrl = (string) => { |
There was a problem hiding this comment.
this can be an util outside of the function
There was a problem hiding this comment.
Also, this is irrelevant when using type="url" in your input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.